package org.yinxianren.www.study_02.study.httpTest;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Base64;
import java.util.Map;
import java.util.TreeMap;

public class NonVerifyPayTest {




    @org.junit.Test
    public void BondCard(){
        try {
            Map<String, Object> map = new TreeMap<>();
            map.put("charset","utf-8");
            map.put("signType","MD5");
            map.put("merId","M201001");
            map.put("merOrderId","20190719002");
            map.put("userName","詹光活");
            map.put("identityType","1");
            map.put("bankCardType","1");
            map.put("identityNum","350425199006012636");
            map.put("bankCardNum","6217001930018496795");
            map.put("bankCardPhone","17605083552");
            map.put("bankCode","CCB");
            map.put("validDate","202011");
            map.put("securityCode","123");
            map.put("terminalMerId","M201001-001");
            map.put("terminalMerName","test");
            map.put("returnUrl","http://...");
            map.put("noticeUrl","http://...");
            map.put("signMsg", CheckMd5Utils.getMd5SignWithKey(map,"1iiG15c2"));
            String tradeInfo = JsonUtils.objectToJson(map);
//            System.out.println(tradeInfo);
            tradeInfo= URLEncoder.encode(tradeInfo,"UTF-8");
            String postJson= new String( Base64.getEncoder().encode(tradeInfo.getBytes()),"UTF-8");
            String content = HttpClientUtils.doPostJson(HttpClientUtils.getHttpsClient(), "http://localhost:8030/nvkuaijie/bondCard", postJson);
            System.out.println(content);

//            System.out.println(postJson);

        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }}






}
